<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>大连高校环境联盟</title>

    <link rel="stylesheet" type="text/css" href="css/hv.css">
    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">  
    <link rel="stylesheet" type="text/css" href="css/bootstrap-dialog.min.css">  

    <script src="js/jquery-1.12.4.min.js"></script>
    <script src="js/sign-up-in.js"></script>
    <script type="text/javascript" src="js/bootstrap.min.js"></script>
    <script type="text/javascript" src="js/bootstrap-dialog.min.js"></script>
    <script type="text/javascript" src="js/utils.js"></script>
</head>

<body>
    <div style="background-color: #036eb8; height: 3px"></div>
        <div style="background-image: url('images/bg1.gif'); height: 120px;">
            <div class="container">
                <div class="container" style="padding-top: 15px">
                    <img src="images/logo_title.png" alt="logo">
                </div>
            </div>
        </div>
    <div class="signUp">
        <div class="a-title">找回密码</div>
        <div class="form">
            <form>
                <div class="show-line">
                    <input type="text" id="email" name="email" placeholder="请输入验证邮箱" onblur="checkMail(this)" data-rule="" autocomplete="off">
                </div>
                <div class="check-result" id="check_mail">
                </div>

                <div class="right_list">
                    <a href="home.html" class="link-index">返回首页</a>
                    <button class="submit fwd_button" id="next" type="button">发送</button>
                </div>
                


            </form>
        </div>
    </div>
</body>
<script>
$(document).ready(function() {
    $('#next').click(function() {
        var reEmail = /^\w+((-\w+)丨(\.\w+))*\@[A-Za-z0-9]+((\.丨-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
        if (!reEmail.test($('#email').val())) {
            if ($('#email').val().length == 0) {
                alertWarning("邮箱不能为空")
            } else {
                alertWarning("邮箱格式有误")
            }
            return;
        }

        // alert("邮箱格式有误qweq")
        $.ajax({
            type: 'post',
            url: 'user/send-reset-email',
            data: {
                email: $('#email').val(),
            },
            success: function(model) {
               if(model.result){
                alertInfo(model.message);
                //window.location.href = "fwd_success.html";//有问题，模态框闪退或不显示
            }
            else{
                alertWarning("邮件发送失败，请检查邮箱是否存在");
            }
            },
            fail: function() {
                alert("failed");
            },
            error: function(response) {
                alert("Error!!!");
            }
        });
        //alert("为什么要加上这一句，才能显示访问记录")
    });
})
</script>

</html>
